package com.Tjise.opp.duotai;

public class TestDriver {
    public static void main(String[] args) {
        test01();
    }

    public static void test01() {
        // 创建一个学生类的实例对象
        Student student = new Student();
        student.doEating();

        System.out.println("----------------------------");
        // 父类指代子类【面向父类的编程】
        Person student1 = new Student();
        // 调用方法
        student1.doEating();

        System.out.println("---------------------------");
        Person person = new Person();
        // 向下溯型【父类强制转换子类】
        Student student2 = (Student) student1;  // 成功
        // 可以调用子类新扩展的方法
        student2.doStuding();
        System.out.println("-------------失败--------------");
        Student student3 = (Student) person; // 失败
    }
}
